<template>
	<view class="Achievememt">
		<view v-if="agentList.length != 0">
			<view class="detailBox Column" v-for="(item,index) in agentList" :key="index">
				<view class="detail-title Row">
					<h4>区域负责人ID {{item.user_id}}</h4>
					<view class="level Row" v-if="item.status == 0">待发放</view>
				</view>

				<view class="detail-items Column">
					<view class="productID Row">
						<h4 class="h4">管理区域</h4>{{item.province}} {{item.city}} {{item.district}}
					</view>
					<view class="productID Row">
						<h4 class="h4">考核日期</h4>{{item.agent_start}} 至 {{item.agent_end}}
					</view>
					<view class="productID Row">
						<h4 class="h4">考核目标数量</h4>{{item.target_num}}
					</view>
					<view class="productID Row">
						<h4 class="h4">考核已完成数量</h4>{{item.status == 0 ? item.num : item.result_num}}
					</view>
					<view class="productID Row">
						<h4 class="h4">每单任务奖励</h4>{{item.unit_reward}}
					</view>
				</view>
			</view>
		</view>

		<view class="null" v-else> 暂无数据 </view>
	</view>
</template>

<script>
	import {
		postMenu,
		getMenu
	} from '@/utils/api.js';
	export default {
		data() {
			return {
				current_page: 1,
				last_page: 1,

				agentList: [],
			};
		},
		onShow() {
			this.current_page = 1;
			this.last_page = 1;
			this.agentList = [];
			this.regionalAgentList()
		},
		methods: {
			regionalAgentList() {
				let that = this;
				if (that.current_page > that.last_page) {
					return;
				}
				uni.$u.http.post('/kafu.dt_regional_agent/regionalAgentList', {
					page: that.current_page,
				}).then(res => {
					let array = res.data.data;
					array.forEach(element => {
						that.agentList.push(element);
					});
				}).catch(err => console.log(err))
			}
		},
		onReachBottom() {
			this.current_page++;
			this.regionalAgentList();
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F5F6F8;
	}

	.Achievememt {
		// width: 100%;
		padding: 12px;

		.null {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 70vh;
		}

		.detailBox {
			align-items: center;
			justify-content: space-between;
			background-color: #fff;
			border-radius: 6px;
			border-bottom: 2rpx solid #F5F6F8;
			padding: 12px;
			margin-bottom: 12px;


			.detail-items {
				width: 100%;
				margin-top: 12px;

				.h4 {
					color: #7E7E9A;
					font-weight: 400;
					margin-right: 4px;
				}

				.productID {
					justify-content: space-between;
					font-size: 30rpx;
				}
			}

			.detail-title {
				justify-content: space-between;
				width: 100%;
				font-size: 16px;
				border-bottom: 1px solid #f6f5fa;
				padding-bottom: 12px;

				.enterprise_type {
					color: #0056FF;
					border-radius: 4px;
					border: 1px solid #7E7E9A;
					padding: 2px 6px;
					margin-right: 6px;
				}

				.level {
					justify-content: center;
					color: #2b72fb;
					font-size: 15px;
					// background-color: #2b72fb;
					// border-radius: 4rpx;
					// padding: 4rpx 12rpx;
					// margin-left: 12rpx;
				}
			}

			&_right {
				width: 100%;
				color: #7E7E9A;
				justify-content: space-around;
				align-items: center;
				margin-top: 20rpx;

				.money {
					width: 35%;
					text-align: center;
					font-size: 32rpx;
					display: flex;
					justify-content: center;
				}

				.time {
					width: 35%;
					font-size: 32rpx;
					display: flex;
					justify-content: center;
				}
			}

			&_left {
				width: 100%;
				justify-content: space-between;
				align-items: flex-start;

				.name {
					font-weight: 500;
				}

				.productID {
					display: flex;
					flex-direction: row;
					align-items: center;
					width: 62%;
					font-size: 16px;
				}
			}
		}
	}
</style>